/**
 *
 */
import Util;
import OpenApi;

import EndpointUtil;

extends OpenApi;

init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('gts-csm-succ', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }

  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}
model AccessClueRequest {
  serviceProduct?: string(name='ServiceProduct'),
  remark?: string(name='Remark'),
  userName?: string(name='UserName'),
  phone?: string(name='Phone'),
  cidName?: string(name='CidName'),
}

model AccessClueResponseBody = {
  code?: int32(name='code', description='Id of the request'),
  data?: {
    clueId?: string(name='clueId'),
    gmtCreate?: string(name='gmtCreate'),
    gmtModified?: string(name='gmtModified'),
    creator?: string(name='creator'),
    modifier?: string(name='modifier'),
    isDeleted?: boolean(name='isDeleted'),
    cid?: long(name='cid'),
    source?: string(name='source'),
    serviceProduct?: string(name='serviceProduct'),
    followerUid?: string(name='followerUid'),
    followerTlUid?: string(name='followerTlUid'),
    creatorUid?: string(name='creatorUid'),
    followerType?: string(name='followerType'),
    expectOrderTime?: string(name='expectOrderTime'),
    expectAmount?: long(name='expectAmount'),
    createTime?: string(name='createTime'),
    state?: string(name='state'),
    remark?: string(name='remark'),
    svcSaleUid?: string(name='svcSaleUid'),
    svcRepresentUid?: string(name='svcRepresentUid'),
    svcAuthUid?: string(name='svcAuthUid'),
    svcPdUid?: string(name='svcPdUid'),
    svcKeepUid?: string(name='svcKeepUid'),
    clueToOppTime?: string(name='clueToOppTime'),
    cidName?: string(name='cidName'),
    expireTime?: string(name='expireTime'),
    daysRemaining?: int32(name='daysRemaining'),
  }(name='data'),
  requestId?: string(name='RequestId'),
  msg?: string(name='msg'),
  traceId?: string(name='TraceId'),
}

model AccessClueResponse = {
  headers: map[string]string(name='headers'),
  body: AccessClueResponseBody(name='body'),
}

async function accessClueWithOptions(request: AccessClueRequest, runtime: Util.RuntimeOptions): AccessClueResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('AccessClue', '2021-05-27', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function accessClue(request: AccessClueRequest): AccessClueResponse {
  var runtime = new Util.RuntimeOptions{};
  return accessClueWithOptions(request, runtime);
}

model FindExclusiveCustomerRequest {
  cidInfo?: string(name='CidInfo'),
  empId?: string(name='EmpId'),
}

model FindExclusiveCustomerResponseBody = {
  requestId?: string(name='RequestId', description='Id of the request'),
  code?: int32(name='Code'),
  msg?: string(name='Msg'),
  traceId?: string(name='TraceId'),
  data?: [ 
    {
      cid?: long(name='Cid'),
      gmtCreate?: string(name='GmtCreate'),
      gmtModified?: string(name='GmtModified'),
      creator?: string(name='Creator'),
      modifier?: string(name='Modifier'),
      isDeleted?: boolean(name='IsDeleted'),
      tenantCode?: string(name='TenantCode'),
      isDeepService?: string(name='IsDeepService'),
      remark?: string(name='Remark'),
      customerNickname?: string(name='CustomerNickname'),
      csmBelongUid?: string(name='CsmBelongUid'),
      csmTlBelongUid?: string(name='CsmTlBelongUid'),
      industryNickname?: string(name='IndustryNickname'),
      postCsmBelongUid?: string(name='PostCsmBelongUid'),
    }
  ](name='Data'),
}

model FindExclusiveCustomerResponse = {
  headers: map[string]string(name='headers'),
  body: FindExclusiveCustomerResponseBody(name='body'),
}

async function findExclusiveCustomerWithOptions(request: FindExclusiveCustomerRequest, runtime: Util.RuntimeOptions): FindExclusiveCustomerResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  return doRPCRequest('FindExclusiveCustomer', '2021-05-27', 'HTTPS', 'POST', 'AK', 'json', req, runtime);
}

async function findExclusiveCustomer(request: FindExclusiveCustomerRequest): FindExclusiveCustomerResponse {
  var runtime = new Util.RuntimeOptions{};
  return findExclusiveCustomerWithOptions(request, runtime);
}

